package com.hikealoha.hikealoha;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.app.Activity;
import android.widget.SeekBar;
import android.widget.SeekBar.*;

public class WaypointActivity extends Activity {
    public final static String EXTRA_MESSAGE = "com.hikealoha.hikealoha.MESSAGE";

    //PhotoPagerAdapter mPhotoPagerAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.waypoint_layout);
        //mPhotoPagerAdapter = new PhotoPagerAdapter(getSupportFragmentManager());
        TextView text;
        ImageView map;
        map = (ImageView) findViewById(R.id.default_oahu_map);
        SeekBar seekBar = (SeekBar)findViewById(R.id.seekBar);
        seekBar.setMax(2);

        final ImageView trailA = (ImageView)findViewById(R.id.trailA);
        final ImageView trailB = (ImageView)findViewById(R.id.trailB);
        final ImageView trailC = (ImageView)findViewById(R.id.trailC);
        seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                if (progress == 0) {
                    trailA.setVisibility(View.VISIBLE);
                    trailB.setVisibility(View.GONE);
                    trailC.setVisibility(View.GONE);
                } else if (progress == 1) {
                    trailB.setVisibility(View.VISIBLE);
                    trailC.setVisibility(View.GONE);
                    trailA.setVisibility(View.GONE);
                } else if (progress == 2) {
                    trailC.setVisibility(View.VISIBLE);
                    trailA.setVisibility(View.GONE);
                    trailB.setVisibility(View.GONE);
                } else {
                    System.err.println("too high");
                }
            }
        });
    }

    public void sendMessageToMap(View v) {
        Intent intent = new Intent(this, MapActivity.class);
        String message = "50, 50";
        intent.putExtra(EXTRA_MESSAGE, message);
        startActivity(intent);
    }

    /*public class PhotoPagerAdapter extends FragmentStatePagerAdapter {
        public PhotoPagerAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int i) {
            Fragment fragment = new PictureFragment();
            Bundle args = new Bundle();
            // Our object is just an integer :-P
            args.putInt(PictureFragment.ARG_OBJECT, i + 1);
            fragment.setArguments(args);
            return fragment;
        }

        @Override
        public int getCount() {
            return 3;
        }
    }

    // Instances of this class are fragments representing a single
// object in our collection.
    public static class PictureFragment extends Fragment {
        public static final String ARG_OBJECT = "object";

        @Override
        public View onCreateView(LayoutInflater inflater,
                                 ViewGroup container, Bundle savedInstanceState) {
            // The last two arguments ensure LayoutParams are inflated
            // properly.
            View rootView = inflater.inflate(
                    R.layout.fragment_picture, container, false);
            Bundle args = getArguments();
            return rootView;
        }
    }*/
}
